import numpy as np
import mindspore.nn as nn
import mindspore
from mindspore import Tensor

# loss = nn.SoftmaxCrossEntropyWithLogits(sparse=True, reduction='mean')
# out_data = Tensor(np.array([[3, 5, 6, 9, 12, 33, 42, 12, 32, 72]]), mindspore.float32)
# # target_data = Tensor(np.array([1]), mindspore.int32)
# target_data = Tensor(np.array([1]), mindspore.int32)
# output = loss(out_data, target_data)
# print(output)

# import mindspore.nn as nn
# from mindvision.classification.models import lenet
#
# momentum = .9
# net = lenet(num_classes=10, pretrained=False)
# optim = nn.Momentum(net.trainable_params(), 0.01, momentum)

import mindspore.nn as nn
from mindspore import Model
from mindvision.engine.callback import LossMonitor
# Model=Model(net)
from mindvision.classification.dataset import Mnist

download_train = Mnist(path='./datasets/mnist', split='train', batch_size=32,
                       shuffle=True, resize=32, download=True)
download_eval = Mnist(path='./datasets/mnist', split='test',
                      batch_size=32, resize=32, download=True)

dataset_train=download_train.run()
dataset_eval=download_eval.run()

aa=444